﻿Public Class LinqWithAnonymousTypes
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Using myEntities As New PhonebookEntities()
            Dim allContacts = From contact In myEntities.contacts
                             Order By contact.lname Ascending
                             Select New With {contact.lname, contact.cell}
            'allContacts in this case is an anonymous type that contains two properties: lname and cell
            Repeater1.DataSource = allContacts
            Repeater1.DataBind()
        End Using
    End Sub

End Class